import { Injectable } from '@angular/core';
// import { Http, Headers } from '@angular/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';

const httpOptions = {
  headers: new HttpHeaders({'Content-Type': 'application/json'})
}

@Injectable()
export class HttpService {

  constructor(public http: HttpClient) {

  }

  postData(url: string, body: any):Observable<Object>{
    return this.http.post(url, body, httpOptions);
  }

  getData(url: string):Observable<Object>{
    return this.http.get(url, httpOptions);
  }

}
